home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ply15dat.zip / TORUBND.PI < prev    next >
Text File  |  1992-10-04  |  2KB  |  56 lines

  1. // Generic Polyray input File
  2. // Polyray input file: Alexander Enzmann
  3.  
  4. // Set up the camera
  5. viewpoint {
  6.    from <0, 5, -5>
  7.    at   <0, 0,  0>
  8.    up   <0, 1,  0>
  9.    angle 30
  10.    resolution 256, 256
  11.    }
  12.  
  13. // Get various surface finishes
  14. include "..\colors.inc"
  15.  
  16. // Set up background color & lights
  17. background midnight_blue
  18. light <10, 10, -20>
  19.  
  20.  
  21. // Torus - basic doughnut shape.  The distance from the origin to the center
  22. // of the ring is "r0", the distance from the center of the ring to the surface
  23. // is "r1".  The hole of the doughnut is lined up with the z-axis.
  24. define r0 1
  25. define r1 0.4
  26.  
  27. // Now define some bounding shapes
  28. define inner_cylinder object { polynomial x^2 + y^2 - (r0-(r1+0.1))^2 }
  29. define outer_sphere   object { sphere <0, 0, 0>, r0+r1+0.1 }
  30. define bound_box      object { box <-(r0+r1+0.1), -(r0+r1+0.1), -(r1+0.1)>,
  31.                                    < (r0+r1+0.1),  (r0+r1+0.1),  (r1+0.1)> }
  32.  
  33. // Define the equation of a torus, using the radii above
  34. define torus_expression (x^2 + y^2 + z^2 - (r0^2 + r1^2))^2 -
  35.                            4 * r0^2 * (r1^2 - z^2)
  36. // Instantiate a torus
  37. object {
  38.    polynomial torus_expression
  39.    root_solver Ferrari
  40.    shiny_red
  41.    rotate <90,0,0>
  42.    }
  43.  
  44. // make a bounding shape for the torus
  45. object {
  46.    (bound_box * outer_sphere) - inner_cylinder
  47.    rotate <90,0,0>
  48.    texture {
  49.       surface {
  50.          ambient white, 0.2
  51.          diffuse 0.1
  52.          transmission white, 0.7, 1.0
  53.          }
  54.       }
  55.    }
  56.